import request from '@/utils/request';
import { getParamsSuffix } from '@/utils/paramsUtils';

export async function listAllByPage(query) {
  const params = getParamsSuffix(query);
  return request(`/api/swservice/v1/sw/es/listAllByPage?${params}`, {
    method: 'GET',
  });
}

/**
 * 新增信息
 * @param params
 * @returns {Promise<any>}
 */
export async function create(params) {
  console.log(params);
  return request('/api/swservice/v1/sw/es/create', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}

/**
 * 更新信息
 * @param params
 * @returns {Promise<any>}
 */
export async function update(params) {
  console.log(params);
  return request('/api/swservice/v1/sw/es/update', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}

/**
 * 删除信息
 * @param params
 * @returns {Promise<any>}
 */
export async function deleteByPrimaryKey(params) {
  return request('/api/swservice/v1/sw/es/deleteByPrimaryKey', {
    method: 'POST',
    requestType: 'form',
    data: { ...params },
  });
}
